{extend name="template/base" /}

{block name="style"}
    <link href="//cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
{/block}

{block name="content"}
<div class="pd-10 mt-30 master">
	<!-- 按钮组 -->
	<div class="cl pd-5 bg-1 bk-gray"> 
		{if condition="showAuth('admin/Article/add')"}
			<span class="f-l mr-5">
				<a class="btn btn-primary radius add-btn" data-title="添加资讯" data-url="{:url('add')}" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加资讯</a>
			</span>
		{/if}
		{if condition="showAuth('admin/Article/batch_proc')"}
			{if condition="showAuth('admin/Article/delete')"}
				<span class="f-l mr-5">
					<a class="btn btn-danger batch-btn radius" data-title="删除" data-type="delete" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
				</span>
			{/if}
			{if condition="showAuth('admin/Article/change_examine')"}
				<span class="f-l mr-5">
					<a class="btn btn-danger-outline batch-btn radius" data-title="审核禁止" data-type="disable" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe6dd;</i> 批量禁止</a>
				</span> 

				<span class="f-l mr-5">
					<a class="btn btn-success-outline batch-btn radius" data-title="审核通过" data-type="pass" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe6e1;</i> 批量通过</a>
				</span> 
			{/if}
			{if condition="showAuth('admin/Article/change_on')"}
				<span class="f-l mr-5">
					<a class="btn btn-danger-outline batch-btn radius" data-title="下架" data-type="shelves" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe6de;</i> 批量下架</a>
				</span> 
				<span class="f-l mr-5">
					<a class="btn btn-success-outline batch-btn radius" data-title="发布" data-type="release" data-url="{:url('batch_proc')}" href="javascript:;"><i class="Hui-iconfont">&#xe603;</i> 批量发布</a>
				</span> 
			{/if}
		{/if}
	</div>
	<!-- 搜索框 -->
	<div class="pd-5 bg-1 bk-gray">
		<form action="{:url('/admin/article/index')}" class="form-inline" role="form" id="search-form">

	        <span class="select-box  radius form-control ">
	          <select class="select arta-cid" size="1" name="cid">
	            <option value="" >请选择资讯分类</option>
	            {volist name="acTree" id="v"}
	            	{if condition="$v.pid == 0"}
	            		<option value="{$v.id}" disabled>{$v.name}</option>
						{volist name="acTree" id="v1"}
							{if condition="$v1.pid == $v.id"}
								<option value="{$v1.id}"{$v1.id == $cid?'selected':''}>|—— {$v1.name}</option>
							{/if}
						{/volist}
	            	{/if}
	            {/volist}
	          </select>
	        </span>

			<input name="title" value="{$title}" type="text" class="form-control"  placeholder="资讯名称">

			<div class="form-group">
				<input type="text" class="form-control datepicker-style start" name="start" value="{$start}" placeholder="修改时间开始" readonly />
				~ 
				<input type="text" class="form-control datepicker-style stop" name="stop" value="{$stop}" placeholder="修改时间结束" readonly />
			</div>

			<div class="radio-box">
				<input type="radio" id="s-3" name="is_examine" value="1" {$is_examine==1? 'checked' : ''}>
				<label for="s-3">通过</label>
			</div>
			<div class="radio-box">
				<input type="radio" id="s-4" name="is_examine" value="2" {$is_examine==2? 'checked' : ''}>
				<label for="s-4">禁止</label>
			</div>

			<div class="radio-box">
				<input type="radio" id="s-1" name="is_on" value="1" {$is_on==1? 'checked' : ''}>
				<label for="s-1">发布</label>
			</div>
			<div class="radio-box">
				<input type="radio" id="s-2" name="is_on" value="2" {$is_on==2? 'checked' : ''}>
				<label for="s-2">下架</label>
			</div>
			&nbsp;
			<button type="submit" class="btn btn-secondary radius mt-10">搜索  </button>
			<button type="button" class="btn btn-default radius mt-10 btn-reset">重置  </button>

		</form>
	</div>
	<!-- 主列表 -->
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr>
				<th scope="col" colspan="9" class="text-c va-m"><h3>资讯列表</h3></th>
			</tr>
			<tr class="text-c">
				<th class="va-m" width="7%">
				    <input type="checkbox" id="checkbox-1" class="select_all">
				    <label for="checkbox-1">全选</label>
				</th>
				<th class="va-m" width="10%">资讯分类</th>
				<th class="va-m" width="7%">排序值</th>
				<th class="va-m" width="10%">资讯标题</th>
				<th class="va-m" width="10%">缩略图</th>
				<th class="va-m" width="15%">修改时间</th>
				<th class="va-m" width="7%">审核状态</th>
				<th class="va-m" width="7%">发布状态</th>
				<th class="va-m">操作</th>
			</tr>
		</thead>
			<tbody>
		{volist name="info" id="v"}
				<tr class="text-c va-m">
					<td class="va-m"><input type="checkbox" name="article_id[]" class="ic-checkbox index-chkbox" value="{$v.id}" /></td>
					<td class="va-m">{$v.cid|getArticleClassifyName}</td>
					<td class="va-m">
						<input class="btn btn-primary size-MINI radius sort-btn" data-id={$v.id} type="button" value="{$v.sort_num}">
					</td>
					<td class="va-m">{$v.title}</td>
					<td class="image-td va-m">
						<!-- 图标 -->
						<img src={$v.logo|showImage="article",###} alt="..." class="img-thumbnail" width="60" height="60">
						<!-- 隐藏的文件上传框 -->
						<input type="file" data-id={$v.id} data-url="{:url('/admin/article/uploadImage')}" id="uploadImage{$v.id}" class="uploda-image" name="image" value="" style="display:none;"/>
					</td>
					<td class="va-m">{$v.update_time|date="Y-m-d H:i:s",###}</td>
					<td data-examine="{$v.is_examine}" data-id="{$v.id}" class="va-m">
						{$v.is_examine? '<a href="javascript:;" class="examine-btn"><span class="label label-success radius">通过</span></a>' : '<a href="javascript:;" class="examine-btn"><span class="label label-danger radius">禁止</span></a>'}
					</td>
					<td data-on="{$v.is_on}" data-id="{$v.id}" class="va-m">
						{$v.is_on? '<a href="javascript:;" class="on-btn"><span class="label label-success radius">发布</span></a>' : '<a href="javascript:;" class="on-btn"><span class="label label-danger radius">下架</span></a>'}
					</td>
					<td class="va-m">
						{if condition="showAuth('admin/Article/details')"}
							<input class="btn btn-primary  radius  size-S details-btn" type="button" data-url="{:url('details',['id'=>$v.id])}" data-title="详情" value="详情">
						{/if}
						{if condition="showAuth('admin/Article/edit')"}
							<input class="btn btn-default  radius  size-S edit-btn" data-url="{:url('edit',['id' => $v.id])}"  type="button"  value="编辑">
						{/if}
						{if condition="showAuth('admin/Article/delete')"}
							{if condition="$v.is_delete"}
								<input class="btn btn-danger radius  size-S delete-btn" data-url="{:url('delete')}" data-id="{$v.id}" type="button" value="删除">
							{/if}
						{/if}
					</td>
				</tr>
		{/volist}
			</tbody>
	</table>
	<!-- 分页 -->
	<div class="ml-10">
	    {$info->render()}
	</div>
</div>

<!-- 包含排序值表单页面 -->
{include file="article/sort_num_page" /} 

<script type="text/javascript">
    var exit_examine = "{:url('/admin/article/change_examine')}";
    var exit_on = "{:url('/admin/article/change_on')}";
</script>

{/block}



{block name="script"}
	<script type="text/javascript" src="__AJS__/article/index.js"></script>
{/block}